<?php
//
// Page Class
// The SDMworld! Network
//

uiLoadLibrary('page');


class clsUmlUseCase extends cDycmsObject
{
	protected $mClsId = 'UmlUseCase';

	const allowedTags = '<a><p><b><em><i><div><br><h1><h2><h3><h4>';
	
	function Render(cDycmsClientNode &$r_client)
	{
		global $gViewerUrl;

		// Wrapper
		$r_client->AddChild($main = new cUiLayer(array('class' => 'Content UmlUseCase')));
		
		// Title bar
		$main->AddChild($title = new cUiLayer(array('class' => 'ContentTitle')));
		$title->AddChild("Use Case: " . $this->mClass->GetIndexValue($this->mId, 'title'));
		$title->AddChild(new cHtmlHyperlink(dyEditorUrl('UmlUseCase', $this->mId), uiGetIcon('pencil')));
		
		// Main body
		$main->AddChild($body = new cHtmlWrapperTag('div',array(
			'class' => 'ContentBody'
		)));
		
		// The split
		$body->AddChild($split = new cUiLayer(array('class' => 'ContentSplitCtr')));
		$split->AddChild($left = new cUiLayer(array('class' => 'ContentLeftSplit')));
		$split->AddChild($right = new cUiLayer(array('class' => 'ContentRightSplit')));
		$split->AddChild(new cUiLayer(array('class' => 'ContentSplitEnd')));
		
		$left = $left->AddChild(new cUiLayer(array('class' => 'ContentDisplay')));
		$right = $right->AddChild(new cUiLayer(array('class' => 'ContentDisplay')));
		
		// Brief description
		$left->AddChild($this->mAttributes['brief']);
		
		// Status, Type
		$left->AddChild($bar = new cUiLayer(array('class' => 'ContentSeparator')));
		$bar->AddChild("Status: ...  Type: ...");
		
		$left->AddChild(new cUiWikiRenderer(cUiWikiRenderer::$zDefaultToks,
			$this->mAttributes['text'], clsUmlUseCase::allowedTags, array(
				'noParagraph' => true
		)));
		
		// The status bar
		$right->AddChild("xx incomplete use cases");
	}

	function DrawEditor(cUiEditor &$editor)
	{
		//
		// Draw the editor form
		//

		$editor->AddChild(new cUiSelection(array(
			'name'=>'type',
			'value'=>$this->mAttributes['type']
		), array(
			'core' => 'Core',
			'system' => 'System',
			'optional' => 'Optional'
		), 'Type'));
		
		$editor->AddChild(new cUiSelection(array(
			'name'=>'status',
			'value'=>$this->mAttributes['status']
		), array(
			'new' => 'New',
			'alpha' => 'Alpha (Incomplete)',
			'beta' => 'Beta (Unstable)',
			'stable' => 'Stable'
		), 'Status'));
		
		$editor->AddChild(new cUiEditorTextArea('brief',
			$this->mAttributes['brief'], 'Brief Description', false));
			
		$editor->AddChild(new cUiEditorTextArea('text',
			$this->mAttributes['text'], null, false));
		
		$editor->AddDefaultButtons();
	}

	function GetSummary()
	{
		return $this->mTitle;
	}

	function LoadObject()
	{

	}

	function GetAttributes($bVals)
	{
		if($bVals)
		{

		}
		else
		{
			return array('title', 'htmlbody', 'htmlhead');
		};
	}

    function Create(){
    	$this->mAttributes = array('type' => 'core', 'status' => 'new', 'text' => <<<END
== Main Flow ==

* Enter steps here.

== Alternate Flows ==

== Preconditions ==

== Postconditions ==


END
);
    }
}

?>
